#ifndef __EVOWALKER_CREATURE_H__
#define __EVOWALKER_CREATURE_H__

#include "Include.h"

struct EvoMass
{
    v2 _pos;
    v2 _old_pos;
    float _mass;
    float _inv_mass;
    EvoMass(const v2& _Pos,const float _Mass=1.f)
        : _pos(_Pos)
        , _old_pos(_Pos)
        , _mass(_Mass)
        , _inv_mass(1.f/_Mass)
    { }
};

//***********************************************
struct EvoSpring
{
    int _masses[2];
    float _current_length;
    float _rest_length;
    float _extension;
    float _strength;
    float _dampening;
    float _frequency;
    float _phase;
    float _amplitude;

    EvoSpring(const int _M0,const int _M1,const float _RestLength,const float _Strength,const float _Dampening=0.01f)
        : _current_length(_RestLength)
        , _rest_length(_RestLength)
        , _strength(_Strength)
        , _dampening(_Dampening)
    {
        _masses[0] = _M0;
        _masses[1] = _M1;
        
        _frequency = 0.1f;
        _phase = RAND*M_PI*2.f;
        _amplitude = 0.1f;
    }
};

//***********************************************
class Creature
{
public:

    void addMass(const v2& _Pos,const float _Mass=1.f);
    void addSpring(const int _M0,const int _M1,const float _Strength,const float _Dampening);
    void update();
    void draw();
    
private:
    
    std::vector<EvoMass> _masses;
    std::vector<EvoSpring> _springs;
    
};



#endif // header gurad

